Skip to content

Conversation

@ghsolomon
Copy link
Contributor

@ghsolomon ghsolomon commented Jan 5, 2026

Hoist P/R Checklist

Pull request authors: Review and check off the below. Items that do not apply can also be
checked off to indicate they have been considered. If unclear if a step is relevant, please leave
unchecked and note in comments.

  • Caught up with develop branch as of last change.
  • Added CHANGELOG entry, or determined not required.
  • Reviewed for breaking changes, added breaking-change label + CHANGELOG if so.
  • Updated doc comments / prop-types, or determined not required.
  • Reviewed and tested on Mobile, or determined not required.
  • Created Toolbox branch / PR, or determined not required.

If your change is still a WIP, please use the "Create draft pull request" option in the split
button below to indicate it is not ready yet for a final review.

Pull request reviewers: when merging this P/R, please consider using a squash commit to
collapse multiple intermediate commits into a single commit representing the overall feature
change. This helps keep the commit log clean and easy to scan across releases. PRs containing a
single commit should be rebased when possible.

@ghsolomon ghsolomon changed the title Add support for validation warnings Add support for validation warnings and info Jan 7, 2026
Copy link
Member

@lbwexler lbwexler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

/** Array of all validations for this record. */
get allValidations(): Validation[] {
return flatMap(this.validations);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth it to improve the names of both the new and pre-existing errors getters? We could add deprecations.

Could take allErrors -> errorsList and/or errors -> errorsMap / errorsByField. (I would vote for the latter as it's ...not a map)

My annoyance here is that we have this other strong convention in store where all means "unfiltered" - which seems very natural - and that's not what this is. Before we extend the existing pattern, would like to consider updating for clarity.

@amcclain
Copy link
Member

amcclain commented Jan 8, 2026

Thanks for this, Greg! Realize it's a lot to corral across forms + stores, different inputs, desktop + mobile.

@lbwexler
Copy link
Member

lbwexler commented Jan 8, 2026

My assumption had been that we would not want to introduce breaking changes/deprecations for this.
Think that's probably a first order question we need to answer.

@ghsolomon
Copy link
Contributor Author

@amcclain and @lbwexler thanks for the feedback. Made another round of changes and marked the addressed comments as "resolved". Holding off on the deprecations / breaking changes for now until we decide

export type RecordValidationResultsMap = Record<string, ValidationResult[]>;

/** Map of Field names to Field-level validation message lists. */
export type RecordValidationMessagesMap = Record<string, string[]>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a separate pass - not this PR - I would like to look at consolidating down to a single /data/Types.ts file that could include all data-package types.

Would also like to add one or two little convenience alias types like such as FieldName = string to help make some of this more self-documenting.

But, again, not looking for this now. Just noting as it's been on my mind to review a general strategy for how and where we define our types - my sense is that dedicated files for each top-level package might be a sweet spot, with exception for model config and component prop types, which could continue to live with their model/comp source.

amcclain and others added 3 commits January 12, 2026 15:17
- Use `--` modifier when appending to validation-related classes.
- Remove some remaining direct uses of the intents or colors in favor of the new per-level CSS vars.
- Define additional base classes for validation messages.
- Fixup changelog to note updates under correct version.
# Conflicts:
#	CHANGELOG.md
* Refactor form CSS classes to follow BEM conventions

* Codev with Greg

- Stop forcing form field info messages to a single line w/clipping - allow to wrap, apply styles used in former ViewManager override example.
- Apply validation color to form field label on desktop, as was already done on mobile.
- Improve non-minimal validation msg display to only use a tooltip if there are multiple messages.
- Simplify some style rules via new BEM conventions

---------

Co-authored-by: Anselm McClain <atm@xh.io>
@amcclain
Copy link
Member

We ended up pushing a bit farther on this, standardizing more of the classes to use the BEM conventions and cleaning up some additional jank.

  • Form field info + validation messages are no longer clipped at a single line - they can wrap to show full contents.
  • Validation displayed inline no longer has a tooltip if there's just a single message - we reserve that for multiple messages on the field, and add a trailing (...) to indicate there's more to see on hover
  • Desktop form field labels change color w/validation status, as was the case on mobile

Before release need to take another pass over the changelog and call out the CSS changes

- New `--xh-intent-xxx-text-color` variants, customized to lighter color for dark theme to enhance legibility + contrast, used for form field validation colors
- New set of `--xh-form-field-label` vars to support var-driven customization of FF labels w/o need for direct CSS selectors (on the just-changed classes)
- Unwind weird/old setting of BP selectors based on (otherwise unused) form-field margin vars
- Fix weird/old defaulting of `--xh-input` vars, which were looking to unqualified `--form-field` versions for their defaults.

&.bp6-inline {
margin-right: var(--xh-form-field-margin-right);
margin-inline-end: 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was surprising / weird that these vars existed but were only being applied here - pretty clearly wrong, looks like the original code was mine from 2018 so 🤷 what was going on.

I highly doubt that any apps were using these to customize, and if they were - well, the vars weren't doing what they claimed to do anyway.

--xh-input-disabled-bg: var(--form-field-disabled-bg, rgba(206, 217, 224, 0.5)); // This and below currently matched from Blueprint defaults
--xh-input-disabled-text-color: var(--form-field-disabled-text-color, rgba(92, 112, 128, 0.5));
--xh-input-disabled-bg: var(--input-disabled-bg, rgba(206, 217, 224, 0.5)); // This and below currently matched from Blueprint defaults
--xh-input-disabled-text-color: var(--input-disabled-text-color, rgba(92, 112, 128, 0.5));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very few apps use this general CSS variable convention of setting the vars without the xh prefix - we have had it from the beginning as it was (maybe still is?) a CSS vars best practice so you don't need to worry about specificity when declaring your value, but these defaults were just wrong and, again, highly doubt it will have an impact on apps.

- CSS vars for customization
- Don't clip to single line on mobile (now consistent with desktop)
@amcclain amcclain changed the title Add support for validation warnings and info New severity levels for form/record validations + enhanced FormField styling Jan 14, 2026
@amcclain amcclain merged commit 862b977 into develop Jan 14, 2026
1 check passed
@amcclain amcclain deleted the fieldWarnings branch January 14, 2026 03:14
amcclain added a commit to xh/toolbox that referenced this pull request Jan 14, 2026
Accompanies HR PR: xh/hoist-react#4194

---------

Co-authored-by: Anselm McClain <atm@xh.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FormField enhancements

4 participants